Skip to content

Conversation

@ne0rrmatrix
Copy link
Member

  • Bug fix

Description of Change

Fix window behavior when entering full screen mode while you have mulitple windows active.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls
2025-02-10.06-44-08.mp4

Copilot AI review requested due to automatic review settings August 3, 2025 22:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where MediaElement full screen mode doesn't work correctly when multiple windows are active on Windows. The fix changes how the app window is identified for full screen operations by using the foreground window instead of the current page's window.

  • Replaces static app window caching with dynamic foreground window detection
  • Uses Windows API GetForegroundWindow() to identify the correct window for full screen operations
  • Enables unsafe blocks in the project to support P/Invoke calls

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
MauiMediaElement.windows.cs Implements P/Invoke to GetForegroundWindow and updates window detection logic
CommunityToolkit.Maui.MediaElement.csproj Enables unsafe blocks to support P/Invoke functionality

ne0rrmatrix and others added 2 commits August 3, 2025 15:57
…windows.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…)` and if it is null throw InvalidOperationException if window is null.
@dotnet-policy-service dotnet-policy-service bot added stale The author has not responded in over 30 days help wanted This proposal has been approved and is ready to be implemented labels Sep 4, 2025
@TheCodeTraveler TheCodeTraveler removed help wanted This proposal has been approved and is ready to be implemented stale The author has not responded in over 30 days labels Oct 15, 2025
@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) October 15, 2025 22:59
@TheCodeTraveler TheCodeTraveler merged commit d772b6c into CommunityToolkit:main Oct 15, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Windows Media Element crash on full screen exit in multi window Environment

2 participants